#include "nWid.h"
#include "ui_nWid.h"

nWid::nWid(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::nWid)
{
    ui->setupUi(this);
}

nWid::~nWid()
{
    delete ui;
}
void nWid::new_nwid(vector<TrafficWid*> twidvec)
{
     for(int i = 0; i < twidvec.size(); ++i)
     {
         ui->widlayout->addWidget(twidvec[i]);
     }
}
//重写mousePressEvent事件,检测事件类型是不是点击了鼠标左键
void nWid::mousePressEvent(QMouseEvent* event)
{
    //如果单击了就触发clicked信号
    if (event->button() == Qt::LeftButton)
    {
        //触发clicked信号
        emit clicked(Traf);
    }
    //将该事件传给父类处理
    QWidget::mousePressEvent(event);
}
